#include "Comm.hpp"

int main()
{
    key_t key = getShmkey();
    cout << "key_t: " << key << endl;
    sleep(2);

    int shmid = Getshm(key, defaultsize);
    cout << "shmid: " << shmid << endl;
    sleep(2);

    char *addr = (char *)ShmAttach(shmid);
    cout << "attch success, addr: " << &addr << endl;
    //sleep(5);

    //进程间通信
    for(char c='A'; c<='Z'; c++)//没有调用系统调用
    {
        addr[c-'A'] = c;
        sleep(1);
    }

    ShmDetach(addr);
    cout << "detach success, addr: " << &addr << endl;
    sleep(5);
    return 0;
}